home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 10811 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.2 KB  |  42 lines

  1. Newsgroups: comp.lang.c
  2. Path: netcom.com!jodell
  3. From: jodell@netcom.com (Jake Odell)
  4. Subject: Re: How to make it BEEP ?
  5. Message-ID: <jodellDoJtqG.2DK@netcom.com>
  6. Organization: NETCOM On-line Communication Services (408 261-4700 guest)
  7. X-Newsreader: TIN [version 1.2 PL1]
  8. References: <4ihuuh$6ul@hatathli.csulb.edu> <4in0ih$o43@zeus.intellinet.com> <4in5r1$j90@druid.borland.com> <4inmv1$ljj@sunburst.ccs.yorku.ca>
  9. Date: Wed, 20 Mar 1996 04:27:52 GMT
  10. Sender: jodell@netcom21.netcom.com
  11.  
  12. Shahed A. Quazi (cs942112@ariel.cs.yorku.ca) posted:
  13. # Hi,
  14.  
  15. # I was wondering if anyone would be kind enough to tell me if there is a
  16. # C function on unix that I can use to make a beep sound. If it's not 
  17. # there,I would really appreciate if someone could give me the code.
  18.  
  19. Depending on your compiler, this may work:
  20.  
  21. #include <stdio.h>
  22. main()
  23. {    printf("\a"); /* alarm sound */
  24.     fflush(stdout);
  25.     return 0;
  26. }
  27.  
  28. With SunOS cc, it prints 'a', with gcc, it beeps.
  29.  
  30. # Actually, I'm writing a very simple program where I need it to beep if 
  31. # the user enters the input in wrong format.
  32.  
  33. # Thanks.
  34.  
  35. # --------------------------------
  36. # Shahed A. Quazi
  37. # York University, Toronto, Canada.
  38. # http://www.yucc.yorku.ca/~shahed
  39.  
  40. -- 
  41. jake@pantheon.us.com   jodell@netcom.com
  42.